#include <tuple>
#include <array>
#include <iostream>
#include "../../common/utf8_output.h"
// 方法1：使用辅助函数打印
template <std::size_t... Is>
void print_sequence(std::index_sequence<Is...>)
{
    // 使用折叠表达式 (C++17)
    ((std::cout << Is << " "), ...);
}

// 方法2：转换成数组后打印
template <std::size_t... Is>
void print_sequence_array(std::index_sequence<Is...>)
{
    int arr[] = {Is...};
    for (int i : arr)
    {
        std::cout << i << " ";
    }
}
template <size_t... N>
static constexpr auto square_nums(size_t index, std::index_sequence<N...>)
{
    constexpr auto nums = std::array<size_t, sizeof...(N)>{N * N...};
    return nums[index];
}

template <size_t N>
constexpr static auto const_nums(size_t index)
{
    return square_nums(index, std::make_index_sequence<N>{});
}

int main()
{
    auto seq = std::make_index_sequence<5>{};
    std::cout << "方法1输出: ";
    print_sequence(seq);
    static_assert(const_nums<101>(100) == 10000, "100的平方应该等于10000");
}
